window.addEventListener('load',function(){
	
	// 点击叉事件
	var xs1p1 = document.querySelector(".xs1 .p1");
	var xs1p2 = document.querySelector(".xs1 .p2");
	var xs1div = document.querySelector(".xs1 div");
	var xs3img = document.querySelector(".xs3-img");
	var top = document.querySelector(".top");
	var topxxx = document.querySelector(".top-xxx")
	var b1 =document.querySelector(".b1");
	var b2 =document.querySelector(".b2");
	var b3 =document.querySelector(".b3");
	var xsbspan1 = document.querySelector(".xs3 span");
	var xsbspan2 = document.querySelector(".xs3 .b3");
	var index =true;
	$('.b').click(function(){
		if(index){
		xs1p1.style.visibility = "hidden";
		xs1p2.style.visibility = "hidden";
		xs1div.style.visibility = "hidden";
		xs3img.style.visibility = "hidden";
		top.style.background = "rgb(50, 144, 255)";
		topxxx.style.display = "block";
		b1.style.transform = "rotate(45deg)";
		xsbspan1.style.background = "#ffffff";
		xsbspan2.style.background = "#ffffff";
		b1.style.top = "10px";
		b2.style.display = "none";
		b3.style.transform = "rotate(-45deg)";
		index = false;
		}else{
			top.style.background = "#fff";
			index = true;
			xs1p1.style.visibility = "inherit";
			xs1p2.style.visibility = "inherit";
			xs1div.style.visibility = "inherit";
			xs3img.style.visibility = "inherit";
			topxxx.style.display = "none";
			b1.style.transform = "rotate(0deg)";
			b3.style.transform = "rotate(0deg)";
			xsbspan1.style.background = "#000";
			xsbspan2.style.background = "#000";
			b1.style.top = "0px";
			b2.style.display = "block";
		}
	})
	
	// 数字增加
	$(window).scroll(function(){
	if($(this).scrollTop()>400){
		 var  shuzi1 = document.querySelector(".i1");
		 var  shuzi2 = document.querySelector(".i2");
		 var  shuzi3 = document.querySelector(".i3");
		 var  shuzi4= document.querySelector(".i4");
		 var t1 = shuzi1.innerHTML;
		 var t2 = shuzi2.innerHTML;
		 var t3 = shuzi3.innerHTML;
		 var t4 = shuzi4.innerHTML;
		 var timer = setInterval(function(){
			 if(t1<118){
				 t1++;
				 shuzi1.innerHTML = t1;
			 }else{
				 clearInterval(timer);
			 }

		 },15);
		 var timer2 = setInterval(function(){
			 if(t2<504){
				t2++;
				shuzi2.innerHTML = t2;
			 }else{
				clearInterval(timer2);
			 }
		 },15);
		 var timer3 = setInterval(function(){
			 if(t3<237){
				t3++;
				shuzi3.innerHTML = t3;	
			 }else{
				clearInterval(timer3);
			 }
		 },15);
		 var timer4 = setInterval(function(){
		 			 if(t3<365){
		 				t3++;
		 				shuzi4.innerHTML = t3;	
		 			 }else{
		 				clearInterval(timer4);
		 			 }
		 },15);
		 
	}
	})
	
	// 轮播图
	var test = new Swiper('.swiper-test',{
		 // loop:true,
		 autoplay:true,
		 pagination:{//分页器
			 el:'.xuanze .swiper-test  .swiper-pagination',
			 clickable:true,
		 },
	})
	
	// 双击事件
	var xq1 = true;
	var p22 = document.querySelector(".bbbr .j .p2");
	var p23 = document.querySelector(".bbbr .jj .p2");
	var p24 = document.querySelector(".bbbr .jjj .p2");
	$('.bbbr .j i').click(function(){
		if(xq1){
			p22.style.display = "none";
			xq1 =!xq1;
		}else{
			p22.style.display = "block";
			xq1 =!xq1;
		}
		
	})
	var xq2 =true;
	$('.bbbr .jj i').click(function(){
	if(xq2){
			p23.style.display = "block";
			xq2 =!xq2;
		}else{
			p23.style.display = "none";
			xq2 =!xq2;
		}
		
	})
	var xq3 = true;
	$('.bbbr .jjj i').click(function(){
	if(xq3){
				p24.style.display = "block";
				xq3 =!xq3;
			}else{
				p24.style.display = "none";
				xq3 =!xq3;
			}
		
	})
	
	// 轮播2
	var test2 = new Swiper('.xinwenzixun .swiper-test',{
		 // loop:true,
		 autoplay:true,
		 pagination:{//分页器
			 el:'.xinwenzixun .swiper-test  .swiper-pagination',
			 clickable:true,
		 },
	})
	
	// 点击2
	var test_top = document.querySelector(".test-top");
	var span11 = document.querySelector(".test-top .span11");
	var span22 = document.querySelector(".test-top .span22");
	var span33 = document.querySelector(".test-top .span33");
	var top_xxxx = document.querySelector(".top-xxxx");
	var quanbu = document.querySelector(".quanbu");
	var sb = true;
	test_top.onclick =function(){
		if(sb){
			span11.style.transform = "rotate(45deg)";
			span22.style.display = "none";
			span33.style.transform = "rotate(-45deg)";
			top_xxxx.style.left = "0px";
			span11.style.background = "#fff";
			span33.style.background= "#fff";
			span11.style.top = "14px";
			quanbu.style.display= "block" ;
			sb=false;
 		}else{
			sb=true;
			span11.style.transform = "rotate(0deg)";
			span22.style.display = "block";
			span33.style.transform = "rotate(0deg)";
			span11.style.background = "#000";
			top_xxxx.style.left = "-300px";
			span11.style.top = "5px";
			quanbu.style.display= "none" ;
		}
	}
	
	// 返回顶部
	var dingbu = document.querySelector(".guding .guding4");
	var guding = document.querySelector(".guding");
	window.onscroll = function(){
	    console.log(document.documentElement.scrollTop);//当前页面滚动条高度
	    if(document.documentElement.scrollTop >= 800){
	        guding.style.display = "block";
	    }else{
	        guding.style.display = "none";
	    }
	}
	dingbu.onclick = function(){ 
	    //document.documentElement.scrollTop = 0;
	    var timer = setInterval(function(){
	        if(document.documentElement.scrollTop==0){
	            clearInterval(timer);
	            //timer = null
	        }else{
	            document.documentElement.scrollTop = document.documentElement.scrollTop - 50;
	        }
	    }, 10)
	}
	
	// 选项卡开始
	var xuanxiangka = document.querySelector(".tab");
	var ulli = document.querySelectorAll(".tab .list li");
	var divcon = document.querySelectorAll(".divcontent div");
	
	for(var i= 0;i<ulli.length;i++){
		ulli[i].setAttribute('index',i);
		ulli[i].onmouseenter = function(){
			var index = this.getAttribute('index');
			for(var j= 0;j<ulli.length;j++){
				ulli[j].classList.remove('active');
				divcon[j].classList.remove('show');
			}
			ulli[index].classList.add('active');
			divcon[index].classList.add('show');
			}
	}
	// 选项卡结束
	
	// 我们团队开始
	var test = new Swiper('.tuandui .swiper-test9',{
		navigation:{
			 nextEl: '.tuandui .swiper-button-next',
			 prevEl: '.tuandui .swiper-button-prev',
		},
		})
	// 我们团队结束
	
	var test = new Swiper('.pingjia .swiper-test10',{
		navigation:{
			 nextEl: '.pingjia .swiper-button-next',
			 prevEl: '.pingjia .swiper-button-prev',
		},
		})
		
	// 地图开始
	var map = new BMap.Map("map",{minZoom:15,maxZoom: 19});
	var point1 = new BMap.Point(110.897181,35.414753);
	map.centerAndZoom(point1,16);
	map.enableScrollWheelZoom(true);
	var blc = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});
	map.addControl(blc); 
	var point2 =new BMap.Point(110.897181,35.414753);
	var circle = new BMap.Circle(point2, 200, {strokeColor:"pink", strokeWeight: 1, strokeOpacity: 0.8});
	map.addOverlay(circle);
	var marker1 = new BMap.Marker(point1);
	map.addOverlay(marker1);
	var arr_point = [
		{x:110.197181,y:35.414753},
	]
	for(var i=0;i<arr_point.length;i++){
		// console.log(arr_point[i].x,arr_point[i].y);
		var point3 = new BMap.Point(arr_point[i].x,arr_point[i].y);
		map.addOverlay(new BMap.Marker(point3));
	}
	
	// 窗口信息
	var opts ={
		width:200, //信息窗口宽度
		height: 100, //信息窗口高度
		title:"解式家族", //信息窗口标题
	}
	
	var infoWindow = new BMap.InfoWindow("地址：山西省运城市万荣县被北牛池",opts);// 创建信息窗口对象
	map.openInfoWindow(infoWindow ,point1);//开启信息窗口
	
	marker1.addEventListener("click", function(){
		// console.log(222);
		map.openInfoWindow(infoWindow, point1); //开启信息窗口
	});
		
})